package edu.sctu.xiangkun.day201506.day20150605.TextOne;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 * Created by lenovo on 2015/6/5.
 */
public class CalendarDemo {
    private static CalendarDemo calenderDemo = null;
    private String string;

    public CalendarDemo(String string){
        this.string = string;
    }

    public static CalendarDemo getInstance(String string){
    if(calenderDemo == null){
        calenderDemo = new CalendarDemo(string);
    }
    return  calenderDemo;
}
    public void getCalendar(){
    Calendar calendar = Calendar.getInstance();
    System.out.println("当前月份："+calendar.get(calendar.MONTH));

}
    public  void getDatetime(){
        Date date = new Date();
        System.out.println("距离现在："+date.getTime());
    }

    public void getNowDate(){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd  HH-mm-ss");
        System.out.println("当前时间："+simpleDateFormat.format(new Date()));
    }

    public static void main(String[] args) {
        CalendarDemo calenderDemo1 = new CalendarDemo("c");
        calenderDemo1.getDatetime();
        calenderDemo1.getNowDate();
        calenderDemo1.getCalendar();

    }
}
